#ifndef __HIKARI__FILE_SECTION__
#define __HIKARI__FILE_SECTION__

#include<iostream>
#include<irrlicht.h>
#include <hash_map>
#include "Chunk.h"
#include"RandomFileAccess.h"
using namespace std;
using namespace stdext;

class FileSection
{
private:
	wstring sectionName;
	hash_map<long, Chunk*>chunksMapping;
	vector<Chunk*>chunks;
protected:
	RandomFileAccess*file;
	void initChunkForReading();
public:
	FileSection(void);
	~FileSection(void);

	Chunk*getChunk(const wstring&string);
	vector<Chunk*>getAllSections();
	vector<Chunk*>getAllAttributes();
	FileSection*readSection(Chunk*chunk);
	wstring readString(Chunk*chunk);
	int readInt(Chunk*chunk);
	irr::video::SColor readSColor(Chunk*chunk);
	irr::core::vector3df readVector(Chunk*chunk);
	irr::core::dimension2df readDimension2df(Chunk*chunk);
	short readShort(Chunk*chunk);
	long long readLong(Chunk*chunk);
	vector<long long> readLongs(Chunk*chunk);
	vector<bool> readBooleans(Chunk*chunk);
	bool readBoolean(Chunk*chunk);
	char readChar(Chunk*chunk);
	unsigned char readByte(Chunk*chunk);
	float readFloat(Chunk*chunk);
	double readDouble(Chunk*chunk);

	wstring& getSectionName(){
		return sectionName;
	}

	void setSectionName(wstring&newSectionName){
		sectionName=newSectionName;
	}
};

#endif